package uk.co.q3c.deplan.client.ui.view;

import java.util.logging.Logger;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.History;

public class ViewCreatorGWT implements ViewCreator {
	protected static final Logger logger = Logger.getLogger(ViewCreatorGWT.class.getName());

	@Override
	public Q3CoreView createView(Viewtags index) {

		Q3CoreView view = null;
		switch (index) {
		case AbstractTaskView:
			view = GWT.create(ProjectTaskViewGWT.class);
			break;
		case ResourcesView:
			view = GWT.create(ResourcesViewGWT.class);
			break;
		case ProjectsView:
			view = GWT.create(ProjectsViewGWT.class);
			break;
		case HomeView:
			view = GWT.create(HomeViewGWT.class);
			break;
		case ProjectView:
			view = GWT.create(ProjectViewGWT.class);
			break;
		default:
			logger.severe("class not defined for index: " + index.toString());
		}
		return view;
	}

	@Override
	public void newHistoryItem(String tokenAsString, boolean issueEvent) {
		History.newItem(tokenAsString, issueEvent);
	}

}
